<template>
    <div class="app-container">
        <!-- 添加或修改定位器对话框 -->
        <com-dialog :title="title" :cstyle="'height:370px'" :visible="open" :width="'750px'" :footer="false"
            @update:visible="(v) => { this.open = v }">
            <div slot="content">
                <el-form ref="form" :model="form" :rules="rules" label-width="100px">
                    <el-form-item label="功能名字" prop="name">
                        <el-input v-model="form.name" placeholder="请输入功能名字" />
                    </el-form-item>
                    <!-- <el-form-item label="执行次数" prop="runnum">
              <el-input-number v-model="form.runnum" :min="1"></el-input-number>
          </el-form-item> -->
                    <el-form-item label="备注" prop="runnum">
                        <el-input type="textarea" v-model="form.Remark" placeholder="请输入备注"></el-input>
                    </el-form-item>
                    <!-- 操作事件 -->
                    <template v-for="(item, index) in form.functionList">
                        <el-divider content-position="left">动作{{ index + 1 }}</el-divider>
                        <!-- 键盘事件 -->
                        <template v-if="item.nowType == 1">
                            <!-- key -->
                            <el-form-item label="按键名" :prop="`functionList[${index}].keyList`" :rules="rules.key">
                                <template v-for="(data, num) in item.keyList">
                                    <el-tag v-show="data.value" closable @close="handleCloseKey(index, num)">
                                        {{ data.label }}
                                    </el-tag>
                                    <input input_key="input_key" :ref="`${index}formKey${num}`" v-show='!data.value'
                                        type="text" @keydown="getKey($event, index, num)" @blur="handelBlur(index, num)"
                                        v-model="data.value">
                                </template>
                                <el-button style="margin-left:10px ;" v-show="item.isShowAdd" type="primary"
                                    icon="el-icon-plus" size="mini" @click="handleAddKey(item, index)">添加按键
                                </el-button>
                            </el-form-item>
                            <el-form-item label="按下方式" :prop="`functionList[${index}].type`" :rules="rules.select">
                                <el-select @change="changeAnxia($event, index)" v-model="item.type" placeholder="请选择">
                                    <el-option v-for="(item, index) in typeOption" :key="index"
                                        :value="item.value"></el-option>
                                </el-select>
                            </el-form-item>
                        </template>
                        <!-- 鼠标动作 -->
                        <template v-if="item.nowType == 2">
                            <el-form-item label="鼠标动作" :rules="rules.select" :prop="`functionList[${index}].mouseactions`">
                                <el-select @change="changeShubiao($event, index, item.mouseactions)"
                                    v-model="item.mouseactions" placeholder="请选择">
                                    <el-option v-for="(item, index) in shubiaodongzuoOpt" :key="index"
                                        :value="item.value"></el-option>
                                </el-select>
                            </el-form-item>
                            <!--   type值为1 -->
                            <el-form-item label="同时按住" v-if="shubiaodongzuoOpt.filter(data => data.type == 1).some(data => data.value ==
                                item.mouseactions)">
                                <el-checkbox-group v-model="item.togetherList">
                                    <el-checkbox label="鼠标中键"></el-checkbox>
                                    <el-checkbox label="鼠标左键"></el-checkbox>
                                    <el-checkbox label="鼠标右键"></el-checkbox>
                                </el-checkbox-group>
                            </el-form-item>
                            <!--   type值为3 -->
                            <el-row v-if="shubiaodongzuoOpt.filter(data => data.type == 3).some(data => data.value ==
                                item.mouseactions)">
                                <el-col :span="12">
                                    <el-form-item label="窗口类名">
                                        <el-input v-model="item.classname" placeholder="请输入" />
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="窗口标题">
                                        <el-input v-model="item.windowstitle" placeholder="请输入" />
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12" :rules="rules.input">
                                    <el-form-item label="移动坐标 X" :prop="`functionList[${index}].xposition`"
                                        :rules="rules.input">
                                        <el-input-number v-model="item.xposition" :min="1" :controls="false"
                                            placeholder="请输入" />
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12" :rules="rules.input">
                                    <el-form-item label="移动坐标 Y" :prop="`functionList[${index}].yposition`"
                                        :rules="rules.input">
                                        <el-input-number v-model="item.yposition" :min="1" :controls="false"
                                            placeholder="请输入">
                                        </el-input-number>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </template>
                        <!-- 音乐 -->
                        <template v-if="item.nowType == 3">
                            <el-form-item label="音乐路径" :prop="`functionList[${index}].path`" :rules="rules.path">
                                <!--                                <el-button v-if="!item.path" type="primary" icon="el-icon-plus" size="mini"-->
                                <!--                                    @click="handleAddPath(index, 'path')">音乐路径-->
                                <!--                                </el-button>-->
                                <!--                                <el-tag v-else closable @close="handelDel(index, 'path')">-->
                                <!--                                    {{ item.path }}-->
                                <!--                                </el-tag>-->
                                <el-select v-model="item.path">
                                    <el-option v-for="data in musicList" :key="data" :value="data"></el-option>
                                </el-select>
                            </el-form-item>
                            <!-- <el-form-item label="播放完毕后再执行下一项" :prop="`functionList[${index}].isnext`" :rules="rules.radio">
                  <el-radio-group v-model="item.isnext">
                      <el-radio label="是">是</el-radio>
                      <el-radio label="否">否</el-radio>
                  </el-radio-group>
              </el-form-item> -->
                        </template>
                        <!-- OBS源 -->
                        <template v-if="item.nowType == 4">
                            <el-form-item label="选择OBS场景" :prop="`functionList[${index}].scene`" :rules="rules.select">
                                <el-select @change="changeObs($event, index, item.scene)" v-model="item.scene"
                                    placeholder="请选择">
                                    <el-option v-for="(item, index) in sceneList" :key="item.sceneIndex"
                                        :value="item.sceneName"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item label="选择OBS来源" :prop="`functionList[${index}].source`" :rules="rules.select">
                                <el-select @change="changeSource($event, index, item.source)" v-model="item.source"
                                    placeholder="请选择">
                                    <el-option v-for="(data, index) in item.obsOpt" :key="index" :label="data.sourceName"
                                        :value="data.sceneItemId"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item label="显示隐藏" :prop="`functionList[${index}].display`" :rules="rules.radio">
                                <el-radio-group v-model="item.display">
                                    <el-radio label="隐藏">隐藏</el-radio>
                                    <el-radio label="显示">显示</el-radio>
                                </el-radio-group>
                            </el-form-item>
                        </template>
                        <!-- 关机 -->
                        <template v-if="item.nowType == 5">
                            <el-form-item label="设置关机" prop="shoutdown">
                                <el-switch v-model="item.shoutdown" active-color="#31343a" inactive-color="#c71515">
                                </el-switch>
                            </el-form-item>
                        </template>
                        <!-- 结束进程 -->
                        <template v-if="item.nowType == 6">
                            <el-form-item label="进程名字" :prop="`functionList[${index}].process`" :rules="rules.input">
                                <el-input v-model="item.process" placeholder="请输入进程名字" />
                            </el-form-item>
                        </template>
                        <!-- 运行指定程序 -->
                        <template v-if="item.nowType == 7">
                            <el-form-item label="程序路径" :prop="`functionList[${index}].processpath`">
                                <el-button v-if="!item.processpath" type="primary" icon="el-icon-plus" size="mini"
                                    @click="handleAddPath(index, 'processpath')">程序路径
                                </el-button>
                                <el-tag v-else closable @close="handelDel(index, 'processpath')">
                                    {{ item.processpath }}
                                </el-tag>
                            </el-form-item>
                        </template>
                        <!-- 运行指定程序 -->
                        <template v-if="item.nowType == 8">
                            <el-form-item label="延时时间" :prop="`functionList[${index}].steeptime`" :rules="rules.input">
                                <el-input-number v-model="item.steeptime" :min="1" :controls="false" placeholder="请输入">
                                </el-input-number>
                            </el-form-item>
                        </template>
                        <!-- 随机盲盒 -->
                        <template v-if="item.nowType == 9">
                            <el-form-item label="随机盲盒" prop="shoutdown">
                                <el-switch v-model="item.shoutdown" active-color="#31343a" inactive-color="#c71515">
                                </el-switch>
                            </el-form-item>
                            <el-form-item label="盲盒事件" prop="shoutValue">
                                <el-row v-show="item.shoutValue.length">
                                    <el-col :span="12" v-for="(data, number) in item.shoutValue" :key="number"
                                        style="margin: 0 0 8px 0;">
                                        <el-select v-model="item.shoutValue[number]">
                                            <el-option v-for="(value, num) in shoutValuList"
                                                :value="value.Name"></el-option>
                                        </el-select>
                                        <el-button type="danger" size="small" style="margin-left: 5px;"
                                            @click="handleDelShout(index, number)">删除该事件</el-button>
                                    </el-col>

                                </el-row>
                                <el-button style="margin-left:10px ;" type="primary" icon="el-icon-plus" size="mini"
                                    @click="handleAddShout(index)">
                                    新增事件
                                </el-button>

                            </el-form-item>

                        </template>
                        <!-- 主播保护 -->
                        <template v-if="item.nowType == 10">
                            <el-form-item label="主播保护" prop="shoutdown">
                                <el-switch v-model="item.shoutdown" active-color="#31343a" inactive-color="#c71515">
                                </el-switch>
                            </el-form-item>
                            <el-form-item label="保护时间(ms)">
                                <el-input-number v-model="item.runtime" :min="0"></el-input-number>
                            </el-form-item>
                        </template>
                        <!-- 传送 -->
                        <template v-if="item.nowType == 11 || item.nowType == 14 || item.nowType == 15">
                            <el-row>
                                <el-col :span="12" :rules="rules.input">
                                    <el-form-item label="传送坐标 X" :prop="`functionList[${index}].xposition`"
                                        :rules="rules.input">
                                        <el-input-number v-model="item.xposition" :controls="false" placeholder="请输入" />
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12" :rules="rules.input">
                                    <el-form-item label="传送坐标 Y" :prop="`functionList[${index}].yposition`"
                                        :rules="rules.input">
                                        <el-input-number v-model="item.yposition" :controls="false" placeholder="请输入">
                                        </el-input-number>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12" :rules="rules.input">
                                    <el-form-item label="传送坐标 Z" :prop="`functionList[${index}].zposition`"
                                        :rules="rules.input">
                                        <el-input-number v-model="item.zposition" :controls="false" placeholder="请输入">
                                        </el-input-number>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </template>
                        <!-- 飞天 -->
                        <template v-if="item.nowType == 12">
                            <el-form-item label="飞天" prop="shoutdown">
                                <el-switch v-model="item.shoutdown" active-color="#31343a" inactive-color="#c71515">
                                </el-switch>
                            </el-form-item>
                            <el-form-item label="飞天时间(ms)">
                                <el-input-number v-model="item.runtime" :min="0"></el-input-number>
                            </el-form-item>
                        </template>
                        <!-- 遁地 -->
                        <template v-if="item.nowType == 13">
                            <el-form-item label="遁地" prop="shoutdown">
                                <el-switch v-model="item.shoutdown" active-color="#31343a" inactive-color="#c71515">
                                </el-switch>
                            </el-form-item>
                            <el-form-item label="飞天时间(ms)">
                                <el-input-number v-model="item.runtime" :min="0"></el-input-number>
                            </el-form-item>
                        </template>
                        <el-form-item label="持续时间" v-if="typeOption.filter(data => data.isTime).some(data => data.value ==
                            item.type) || shubiaodongzuoOpt.filter(data => data.isTime).some(data => data.value ==
                                item.mouseactions) || item.isShow == '显示'">
                            <el-input-number v-model="item.runtime" :min="0"></el-input-number>
                        </el-form-item>
                        <template v-if="item.nowType !== 8">
                            <el-form-item label="执行方式" :prop="`functionList[${index}].runtype`" :rules="rules.select">
                                <el-radio-group v-model="item.runtype">
                                    <el-radio label="立即执行">立即执行</el-radio>
                                    <el-radio label="排队执行">排队执行</el-radio>
                                </el-radio-group>
                            </el-form-item>
                            <el-form-item label="执行次数" :prop="`functionList[${index}].runnum`" :rules="rules.input">
                                <el-input-number v-model="item.runnum" :min="1"></el-input-number>
                            </el-form-item>
                        </template>
                        <div style="text-align: center;">
                            <el-button type="danger" size="small" @click="handleDel(index)">删除当前动作</el-button>
                        </div>
                    </template>
                </el-form>
            </div>
            <div slot="footer" class="dialog-footer">
                <el-row style="margin-bottom: 15px;">
                    <el-col :span="4">
                        <el-button type="primary" size="mini" @click="handleFunction(1)">添加键盘操作
                        </el-button>
                    </el-col>
                    <el-col :span="4">
                        <el-button type="primary" size="mini" @click="handleFunction(2)">添加鼠标操作
                        </el-button>
                    </el-col>
                    <el-col :span="4">
                        <el-button type="primary" size="mini" @click="handleFunction(3)">添加音乐
                        </el-button>
                    </el-col>

                    <el-col :span="4">
                        <el-button type="primary" size="mini" @click="handleFunction(4)">添加OBS源
                        </el-button>
                    </el-col>
                    <!-- <el-col :span="5" style="position: relative;" class="box_button_hover">
                        <el-button type="primary" size="mini" class="box_left_info_avatar">
                            添加特殊功能<i class="el-icon-arrow-up el-icon--right"></i>
                        </el-button>
                        <Transition name="slide">
                            <ul class="meau_head" ref="dropdown">
                                <li class="meau_item" @click="handleFunction(5)">设置关机</li>
                                <li class="meau_item" @click="handleFunction(6)">结束指定进程</li>
                                <li class="meau_item" @click="handleFunction(7)">运行指定程序</li>
                                <li class="meau_item" @click="handleFunction(9)">随机盲盒</li>
                                <li class="meau_item" @click="handleFunction(10)">主播保护</li>
                                <li class="meau_item" @click="handleFunction(11)">onlly传送</li>
                                <li class="meau_item" @click="handleFunction(12)">onlly飞天</li>
                                <li class="meau_item" @click="handleFunction(13)">onlly遁地</li>
                            </ul>
                        </Transition>
                    </el-col> -->
                    <el-col :span="5">
                        <el-dropdown v-if="dropdownShow" trigger="hover" @command="handelDelDropdown">
                            <span class="el-dropdown-link">
                                添加特殊功能<i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                            <el-dropdown-menu slot="dropdown">
                                <el-dropdown-item command="5">设置关机</el-dropdown-item>
                                <el-dropdown-item command="6">结束指定进程</el-dropdown-item>
                                <el-dropdown-item command="7">运行指定程序</el-dropdown-item>
                                <el-dropdown-item command="9">随机盲盒</el-dropdown-item>
                                <el-dropdown-item command="10">主播保护</el-dropdown-item>
                                <el-dropdown-item command="11">only传送</el-dropdown-item>
                                <el-dropdown-item command="12">only飞天</el-dropdown-item>
                                <el-dropdown-item command="13">only遁地</el-dropdown-item>
                                <el-dropdown-item command="14">小小梦魇传送</el-dropdown-item>
                                <el-dropdown-item command="15">小小梦魇相对传送</el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </el-col>
                    <el-col :span="3.5">
                        <el-button type="primary" size="mini" @click="handleFunction(8)">添加延时
                        </el-button>
                    </el-col>
                </el-row>
                <el-button type="primary" @click="submitForm">确 定</el-button>
                <el-button type="primary" @click="cancel">取 消</el-button>
            </div>
        </com-dialog>
    </div>
</template>
<script>
import ComDialog from "@/components/ComDialog";
import {
    FunctionSubmit, GetfunciotnList, GetMusic, GetOBSScene, FunctionUpdate, GetObsSceneItemList, Getfile, GetfunctionInfo
} from '../../../../wailsjs/go/main/App'

export default {

    components: { ComDialog },
    name: "GpsLocatorInfoOpt",
    data() {
        return {
            //             {
            //     "Type": 0,// 移动1 点击2 移动指定位置3
            //     "mouseactions": "向上移动",//事件名称
            //     "Together": "0,1,2", //同时按住
            //     "Position": "100,200",//坐标（点击指定位置）
            //     "runtime": 1000,//持续时间
            //     "runtype": 0,//执行方式------------------------------
            //     "classname": "窗口类名",
            //     "windowstitle": "窗口标题",
            //     "IsWindows": 0 //是否相对于窗口
            // }
            // 弹出层标题
            title: "",
            // 是否显示弹出层
            open: false,
            // 表单参数
            // type 区分类型
            form: {
                functionList: [],
            },
            musicList: [],
            // 表单校验
            rules: {
                name: [
                    { required: true, message: "功能名字不能为空", trigger: "blur" }
                ],
                select: [{ required: true, message: "请选择", trigger: "blur" }],
                input: [{ required: true, message: "请输入", trigger: "blur" }],
                radio: [{ required: true, message: "请选择", trigger: "blur" }],
                path: [{ required: true, message: "请选择", trigger: "blur" }],
            },
            // 按下方式
            typeOption: [
                {
                    value: '单机按键',
                },
                {
                    value: '按下按键',
                    isTime: true
                },
                {
                    value: '抬起按键',
                },
            ],
            dropdownShow: false,
            shoutValuList: [],
            // 鼠标动作
            shubiaodongzuoOpt: [
                {
                    value: '向左移动',
                    type: 1,
                    isTime: true
                },
                {
                    value: '向右移动',
                    type: 1,
                    isTime: true
                },
                {
                    value: '向上移动',
                    type: 1,
                    isTime: true
                },
                {
                    value: '向下移动',
                    type: 1,
                    isTime: true
                },
                {
                    value: '左键按下', type: 2, isTime: true
                },
                {
                    value: '左键弹起', type: 2
                },
                {
                    value: '左键单击', type: 2
                },
                {
                    value: '左键双击', type: 2
                },
                {
                    value: '右键按下', type: 2, isTime: true
                },
                {
                    value: '右键弹起', type: 2
                },
                {
                    value: '右键单击', type: 2,
                },
                {
                    value: '滑轮按下', type: 2, isTime: true
                },
                {
                    value: '滑轮单击', type: 2
                },
                {
                    value: '滑轮向上',
                    type: 1
                },
                {
                    value: '滑轮向下',
                    type: 1
                },
                {
                    value: '点击指定位置',
                    type: 3
                },
                {
                    value: '移动指定位置',
                    type: 3
                },
            ],
            // 需要有同时按下的
            toger: [
                '向左移动',
                '向右移动',
                '向上移动',
                '向上移动',
                '滑轮向上',
                '滑轮向下',
            ],
            sceneList: [],//场景
        };
    },
    mounted() {
        // 获取事件列表
        GetfunciotnList().then(res => {
            this.shoutValuList = JSON.parse(res);
        })
        // 获取obs
        GetOBSScene().then(res => {
            this.sceneList = JSON.parse(res);
        })
        GetMusic().then(res => {
            this.musicList = JSON.parse(res);
        })
    },
    methods: {
        // 添加随机盲盒事件
        handleAddShout(index, num) {
            this.form.functionList[index].shoutValue.push('')
        },
        // 删除
        handleDelShout(index, num) {
            let arr = this.form.functionList[index].shoutValue.filter(((item, del) => {
                return num !== del
            }))
            this.form.functionList[index].shoutValue = arr;
        },
        // 改变按下方式
        changeAnxia(e, index) {
            this.form.functionList[index].runtime = 0;
        },
        // 改变鼠标动作
        changeShubiao(e, index, value) {
            // type 1
            if (!this.shubiaodongzuoOpt.filter(data => data.type == 1).some(data => data.value ==
                value)) {
                this.form.functionList[index].togetherList = [];
            }
            // type 2
            if (!this.shubiaodongzuoOpt.filter(data => data.type == 3).some(data => data.value ==
                value)) {
                this.form.functionList[index].classname = '';
                this.form.functionList[index].windowstitle = '';
                this.form.functionList[index].xposition = null;
                this.form.functionList[index].yposition = null;
                this.form.functionList[index].zposition = null;
            }
        },
        // 改变场景
        changeObs(e, index, name) {
          console.log("输出的内容是"+e, index, name)
          debugger
            let _this = this;
            // name是name
            _this.form.functionList[index].source = null;
            let obj = _this.sceneList.filter(item => item.sceneName == name)[0];
            _this.form.functionList[index].sceneltemld = obj.sceneIndex;
            GetObsSceneItemList(name).then(res => {
                _this.form.functionList[index].obsOpt = JSON.parse(res);
            })
        },
        changeSource(e, index, id) {
            let obj = this.form.functionList[index].obsOpt.filter(item => item.sceneItemId == id)[0];
            this.form.functionList[index].sourceName = obj.sourceName;
        },
        // 键盘监听
        getKey(e, index, num) {
            // 阻止默认事件
            e.preventDefault();
            // 获取key值
            this.form.functionList[index].keyList[num].value = e.keyCode;
            this.form.functionList[index].keyList[num].label = e.key;
            this.form.functionList[index].isShowAdd = true;
            this.$forceUpdate();
        },
        // 删除当前键盘值
        handleCloseKey(index, num) {
            this.form.functionList[index].keyList = this.form.functionList[index].keyList.filter((item, min) => {
                console.log(min);
                return num !== min
            });
        },
        // 失去焦点
        handelBlur(index, num) {
            this.form.functionList[index].isShowAdd = true;
            // 通过value清除当前行数据
            this.form.functionList[index].keyList = this.form.functionList[index].keyList.filter(item => item.value);
            this.$forceUpdate();
        },
        // 删除动作
        handleDel(nowNum) {
            this.form.functionList = this.form.functionList.filter((item, index) => {
                return nowNum !== index
            });
            this.$forceUpdate();
        },
        // 添加按键
        handleAddKey(item, index) {
            let _this = this;
            this.form.functionList[index].keyList.push({ value: '', keyCode: '' });
            this.$forceUpdate();
            this.$nextTick(() => {
                setTimeout(() => {
                    _this.$refs[`${index}formKey${_this.form.functionList[index].keyList.length - 1}`][0].focus();
                    _this.form.functionList[index].isShowAdd = false;
                    _this.$forceUpdate();
                }, 10)
            })
        },
        // 添加音乐路径
        handleAddPath(index, type) {
            let _this = this;
            Getfile().then(res => {
                _this.form.functionList[index][type] = res;
                _this.$forceUpdate();
            })
        },
        // 删除
        handelDel(index, type) {
            this.form.functionList[index][type] = null;
        },
        // 取消按钮
        cancel() {
            this.open = false;
            this.reset();
        },
        // 表单重置
        reset() {
            this.dropdownShow = false;
            this.form = {
                name: null,
                Remark: null,
                functionList: []
            };
            this.$nextTick(() => {
                this.dropdownShow = true;
            })
            this.$forceUpdate();
        },
        /** 新增按钮操作 */
        handleAdd() {
            this.open = true;
            this.$forceUpdate();
            this.reset();
            this.title = "新增功能";
            this.$forceUpdate();
        },
        /** 修改按钮操作 */
        handleUpdate(row) {
            this.title = "修改功能";
            this.reset();
            console.log("修改的数据是=======2222222"+row);
            GetfunctionInfo(row.Name).then(res => {
                console.log();
                this.form = JSON.parse(JSON.parse(res));
                this.open = true;
                this.$forceUpdate();
            })
        },
        /** 提交按钮 */
        submitForm() {
            this.$refs["form"].validate(valid => {
                if (valid) {
                    if (this.title == '修改功能') {
                        FunctionUpdate(JSON.stringify(this.form)).then(res => {
                          console.log("输出的res值是多少=============111111111111"+res)
                            // 1的时候成功
                            if (res == '1') {
                                this.open = false;
                                this.$emit('getList')
                            } else {

                            }
                        })
                    } else {
                        FunctionSubmit(JSON.stringify(this.form)).then(res => {
                          console.log("输出的res值是多少=============222222222222222"+res)
                            // 1的时候成功
                            if (res == '1') {
                                this.open = false;
                                this.$emit('getList')
                            } else {

                            }
                        })
                        // eCallFunction('submit', JSON.stringify(parms), (data) => {
                        //     // 1的时候成功
                        //     if (data == '1') {
                        //         this.open = false;
                        //         this.$emit('getList')
                        //     } else {
                        //     }
                        // })
                    }
                }
            });
        },
        // 触发下拉框
        handelDelDropdown(e) {
            this.handleFunction(e - 0)
        },
        handleFunction(num) {
            let data = {
                nowType: num,//当前标识
                type: null,//按下方式
                mouseactions: null,//事件名称
                togetherList: [],//同时按住数组
                together: null,//同时按住字符串
                classname: null,//窗口类名
                windowstitle: null,//窗口标题
                xposition: null,//X坐标
                yposition: null,//y坐标
                zposition: null,//z坐标
                path: null,//选择路径
                isnext: null,//是否进行下
                scene: null,//选择OBS场景
                obsOpt: [],//来源的数组
                sceneItemId: null,//选择OBS来源
                display: null,//显示隐藏
                shoutdown: true,//开关
                process: null,//进程名字
                processpath: null,//程序路径
                steeptime: null,//延时时间
                runtime: 0,//持续时间
                runtype: '排队执行',//执行方式
                runnum: 1,//执行次数
                keyList: [],//按键名
                isShowAdd: true,//
                sceneltemld: null,//场景
                sourceName: null,//来源名字
                source: null,//来源ID
                shoutValue: [],
            }
            this.form.functionList.push(data)
            this.showDropdown = false;
        },
    }
};
</script>
<style lang="less">
.meau_head {
    opacity: 0;
    position: absolute;
    bottom: 20px;
    right: -20px;
    background: #333333;
    z-index: 2046;
    text-align: center;
    list-style: none;
    padding: 5px 0;
    border-radius: 5px;
    transition: opacity 0.2s ease;

    .meau_item {
        line-height: 22px;
        padding: 0 12px;
        font-size: 14px;
        cursor: pointer;

        &:hover {
            background: rgba(128, 128, 128, 0.5);
        }

        &:active {
            background: rgba(128, 128, 128, 0.8);
        }
    }


}

.box_button_hover {
    &:hover {
        .meau_head {
            opacity: 1;
            transition: opacity 0.2s ease;
        }
    }
}

.meau_head-enter-hover,
.meau_head-leave-hover {
    transition: opacity 0.1s;
}

.meau_head-enter,
.meau_head-leave-to {
    opacity: 0;
}

input[input_key=input_key]:focus {
    outline: none;
    // box-shadow: 0 0 0 0 transparent;
}

input[input_key=input_key] {
    padding: 3px 0;
    // background: #252525; width: 70px;
    // box-shadow:inset 0px 0px 0px 0px red; // caret-color: #fff;
}
</style>